<?php

namespace App\Http\Requests;


use App\Rules\TradeQueueStoreAmount;

class TradeQueueRequest extends FormRequest
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'type'=> [
                'required',
                'in:deposit,withdraw',

            ],
            'amount' => [
                'required',new TradeQueueStoreAmount()
            ]
        ];
    }
    public function messages()
    {
        return [
            'type.required'=>['error_code'=>'F005001','message'=>'入金|提现不能为空！'],
            'type.in'=>['error_code'=>'F005002','message'=>'入金|提现不正确！'],
            'amount.required'=>['error_code'=>'F005003','message'=>'金额不能为空！'],
        ];
    }


//    protected function prepareForValidation()
//    {
//        if ($this->route('type')) {
//            $this->merge(['type' => $this->route('type')]);
//        }
//    }
}
